package calculator;

import exceptions.InvalidExpressionException;

/*
 * IEvaluator.java
 * Author: Ben McCormick
 * Written: January 8 2011
 * Last Edited: May 16 2011
 * Ben McCormick 2011
 * This file is part of The Eikona Project .
 *    Copyright 2011 Ben McCormick
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *    
 *    http://www.apache.org/licenses/LICENSE-2.0
 *    
 *     Unless required by applicable law or agreed to in writing, software
 *     distributed under the License is distributed on an "AS IS" BASIS,
 *     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *     See the License for the specific language governing permissions and
 *     limitations under the License.
 */


public interface IEvaluator {

	public static final int RADIANS = 1;
	public static final int DEGREES = 2;
	public static final int GRADIANS = 3;

	/***
	 * adds a variable and its value in the MathEvaluator
	 */
	public abstract void addVariable(String v, Double val);

	/***
	 * sets the expression
	 * @throws Exception 
	 */
	public abstract void setExpression(String s) throws Exception;

	/***
	 * evaluates and returns the value of the expression
	 * @throws InvalidExpressionException 
	 * @throws UnsetVariableException 
	 * @throws NumberFormatException 
	 */
	public abstract Double getValue() throws InvalidExpressionException, NumberFormatException, InvalidExpressionException;

	/***
	 * gets the variable's value that was assigned previously 
	 */
	public abstract Double getVariable(String s);

	/**
	 * Get the angleUnits (Radians, Degrees)
	 * @return the angle
	 */
	public abstract int getAngleUnits();
	
	/** Sets the angle units (Radians, Degrees) */
	public abstract void setAngleUnits(int units);

}